﻿using Microsoft.EntityFrameworkCore;
using Prism.Ioc;
using Prism.Modularity;

using WorkshopModule.DbContexts;
using WorkshopModule.ViewModels;
using WorkshopModule.Views;

namespace WorkshopModule {
    public class WorkshopProfile : IModule {
        public void OnInitialized(IContainerProvider containerProvider) {

        }
        public void RegisterTypes(IContainerRegistry containerRegistry) {
            containerRegistry.RegisterForNavigation<WorkShopDetailUC, WorkShopDetailUCViewModel>();
            containerRegistry.RegisterForNavigation<RingUC>();
            //重写一个vm太麻烦
            containerRegistry.RegisterForNavigation<DevicesUC, WorkShopDetailUCViewModel>();

            containerRegistry.RegisterScoped<WorkshopDbContext>(provider => {
                var optionsBuilder = new DbContextOptionsBuilder<WorkshopDbContext>();
                optionsBuilder.UseSqlite("Data Source=D:\\Projects\\sqlite\\workshop.db;");
                return new WorkshopDbContext(optionsBuilder.Options);
            });
        }
    }
}